<!doctype html>
<html lang="zh-CN">
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <meta name="referrer" content="no-referrer-when-downgrade">
    

    <title>转载-shell 13问 | Anttu&#39;s Blog</title>
    <meta property="og:title" content="转载-shell 13问 - Anttu&#39;s Blog">
    <meta property="og:type" content="article">
        
    <meta property="article:published_time" content='2022-04-22T00:29:47&#43;08:00'>
        
        
    <meta property="article:modified_time" content='2022-04-22T00:29:47&#43;08:00'>
        
    <meta name="Keywords" content="golang,go语言,go语言笔记,anttu,java,博客,bash,linux笔记,python笔记,公众号,小程序">
    <meta name="description" content="shell 13问">
        
    <meta name="author" content="Anttu">
    <meta property="og:url" content="https://anttu.gitee.io/post/2022-04-22-shell_question/">
    <link rel="shortcut icon" href='/favicon.ico'  type="image/x-icon">

    <link rel="stylesheet" href='/css/normalize.css'>
    <link rel="stylesheet" href='/css/style.css'>
    <script type="text/javascript" src="//cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    
    
    
    
    
    
        <link rel="stylesheet" href='/css/asciinema-player.css'>
    
</head>


<body>
    <header id="header" class="clearfix">
    <div class="container">
        <div class="col-group">
            <div class="site-name ">
                
                    <a id="logo" href="https://anttu.gitee.io/">
                        Anttu&#39;s Blog
                    </a>
                
                <p class="description">一位Java开发者，喜欢研究技术，同时也在学习Golang和Python中，对服务器、Linux使用比较熟悉。欢迎添加技术交流QQ群：655158296</p>
            </div>
            <div>
                <nav id="nav-menu" class="clearfix">
                    <a class="current" href="https://anttu.gitee.io/">首页</a>
                    
                    <a  href="https://anttu.gitee.io/archives/" title="归档">归档</a>
                    
                    <a  href="https://anttu.gitee.io/tags/" title="分类">分类</a>
                    
                    <a  href="https://anttu.gitee.io/about/" title="关于">关于</a>
                    
                </nav>
            </div>
        </div>
    </div>
</header>

    <div id="body">
        <div class="container">
            <div class="col-group">

                <div class="col-8" id="main">
                    
<div class="res-cons">
    <style type="text/css">
    .post-toc {
        position: fixed;
        width: 200px;
        margin-left: -210px;
        padding: 5px 10px;
        font-family: Athelas, STHeiti, Microsoft Yahei, serif;
        font-size: 12px;
        border: 1px solid rgba(0, 0, 0, .07);
        border-radius: 5px;
        background-color: rgba(255, 255, 255, 0.98);
        background-clip: padding-box;
        -webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, .125);
        box-shadow: 1px 1px 2px rgba(0, 0, 0, .125);
        word-wrap: break-word;
        white-space: nowrap;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        z-index: 999;
        cursor: pointer;
        max-height: 70%;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .post-toc .post-toc-title {
        width: 100%;
        margin: 0 auto;
        font-size: 20px;
        font-weight: 400;
        text-transform: uppercase;
        text-align: center;
    }

    .post-toc .post-toc-content {
        font-size: 15px;
    }

    .post-toc .post-toc-content>nav>ul {
        margin: 10px 0;
    }

    .post-toc .post-toc-content ul {
        padding-left: 20px;
        list-style: square;
        margin: 0.5em;
        line-height: 1.8em;
    }

    .post-toc .post-toc-content ul ul {
        padding-left: 15px;
        display: none;
    }

    @media print,
    screen and (max-width:1057px) {
        .post-toc {
            display: none;
        }
    }
</style>
<div class="post-toc" style="position: absolute; top: 188px;">
    <h2 class="post-toc-title">文章目录</h2>
    <div class="post-toc-content">
        <nav id="TableOfContents">
  <ul>
    <li><a href="#前言">前言</a></li>
    <li><a href="#1为何叫做-shell">1、为何叫做 Shell？</a></li>
    <li><a href="#2shell-promptps1与-carriage-returncr的关系">2、Shell prompt（PS1）与 Carriage Return（CR）的关系？</a></li>
    <li><a href="#3别人echo你也echo试问-echo-知多少">3、别人echo，你也echo，试问 echo 知多少?</a></li>
    <li><a href="#4双引号与单引号有什么区别">4、双引号&quot;&ldquo;与单引号&rsquo;&lsquo;有什么区别?</a></li>
    <li><a href="#5varvalue-export-前后差在哪">5、var=value? export 前后差在哪？</a></li>
    <li><a href="#6exec-跟-source-差在哪">6、exec 跟 source 差在哪？</a></li>
    <li><a href="#7--与---差在哪">7、( ) 与 { } 差在哪？</a></li>
    <li><a href="#8-与--还有--差在哪">8、$(()) 与 $() 还有 ${} 差在哪？</a></li>
    <li><a href="#9-与--区别在哪">9、$@ 与 $* 区别在哪？</a></li>
    <li><a href="#10-与--差在哪">10、&amp;&amp; 与 || 差在哪？</a>
      <ul>
        <li><a href="#101test命令有两种形式">10.1、test命令有两种形式</a></li>
        <li><a href="#102bash的test目前支持三种测试对象">10.2、bash的test目前支持三种测试对象</a></li>
        <li><a href="#103当-expression-为真是返回-0true-否则返回-非0false">10.3、当 expression 为真是返回 0（true） ，否则返回 非0（false）</a></li>
        <li><a href="#104先替换变量再比较">10.4、先替换变量再比较</a></li>
      </ul>
    </li>
    <li><a href="#11-与--差在哪">11、&gt; 与 &lt; 差在哪？</a></li>
    <li><a href="#12你要if还是case呢">12、你要if还是case呢？</a></li>
    <li><a href="#13for-what-while与until差在哪">13、for what? while与until差在哪？</a></li>
  </ul>
</nav>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        var postToc = $(".post-toc");
        if (postToc.length) {
            var leftPos = $("#main").offset().left;
            if (leftPos < 220) {
                postToc.css({ "width": leftPos - 10, "margin-left": (0 - leftPos) })
            }

            var t = postToc.offset().top - 20,
                a = {
                    start: {
                        position: "absolute",
                        top: t
                    },
                    process: {
                        position: "fixed",
                        top: 20
                    },
                };
            $(window).scroll(function () {
                var e = $(window).scrollTop();
                e < t ? postToc.css(a.start) : postToc.css(a.process)
            })
        }

        if ($("#TableOfContents").children().length < 1) {
            $(".post-toc").remove();
        }
    })
</script>
    <article class="post">
        <header>
            <h1 class="post-title">转载-shell 13问</h1>
        </header>
        <date class="post-meta meta-date">
            2022年4月22日
        </date>
        
        <div class="post-meta">
            <span>|</span>
            
            <span class="meta-category">
                <a href='/categories/linux' target="_blank">linux</a>
            </span>
            
            <span class="meta-category">
                <a href='/categories/shell' target="_blank">shell</a>
            </span>
            
        </div>
        
        
        <div class="post-meta">
            <span id="busuanzi_container_page_pv">|<span id="busuanzi_value_page_pv"></span><span>
                    阅读</span></span>
        </div>
        
        
        <div class="clear" style="display: none">
            <div class="toc-article">
                <div class="toc-title">文章目录</div>
            </div>
        </div>
        
        <div class="post-content">
            <h2 id="前言">前言</h2>
<p>shell编写入门的时候，有幸看到比较经典的 shell 13问，碰到有大佬整理成 markdown 格式，转载过来</p>
<h2 id="1为何叫做-shell">1、为何叫做 Shell？</h2>
<p>我们知道计算机的运作离不开硬件，但却无法直接操作硬件，硬件的驱动只能通过一种称之为“操作系统（OS，Opertating System）的软件来管控。Linux 严格来说是一个操作系统（OS）。</p>
<p>使用者没有办法直接操作 Kernel，而是通过 Kernel 的“外壳”程序，也就是所谓的 Shell 来与 Kernel 沟通。Shell 是一个使用者与系统的交互界面（Interface），只能通过命令行（Command line）来使用系统来完成工作。因此 Shell 最简单的定义就是：命令解译器（Command Interpreter）</p>
<ul>
<li>将使用者的命令翻译给内核处理；</li>
<li>同时，将内核处理结果翻译给使用者。</li>
</ul>
<p>不同的 OS 使用不同的 Kernel；同一个 kernel 之上，也可以使用不同的 Shell，常见的 Shell 有sh、bash、csh、ksh 等</p>
<h2 id="2shell-promptps1与-carriage-returncr的关系">2、Shell prompt（PS1）与 Carriage Return（CR）的关系？</h2>
<p>成功登录一个 Shell 终端后，光标左边部分称之为提示符 Prompt，通常一般用户使用$，管理员用户使用#</p>
<ul>
<li>Shell Prompt：可以输入命令了，键入命令后，直到读进 CR（Carriage Return）字符为止</li>
<li>Carriage Return：可以执行命令了</li>
</ul>
<blockquote>
<p>若从技术的细节来看，Shell 会依据 IFS（Internal Field Seperator）将 Command line 所输入的文字拆解为”字段”（word/field）。然后再针对特殊字符（meta）先作处理，最后重组整行command line。</p>
</blockquote>
<h2 id="3别人echo你也echo试问-echo-知多少">3、别人echo，你也echo，试问 echo 知多少?</h2>
<p>echo 将 argument送到标准输出（stdout），通常显示在屏幕</p>
<ul>
<li>stdin 标准输入</li>
<li>stdout 标准输出</li>
<li>stderr 标准错误输出</li>
</ul>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#0086b3">echo</span> -n  <span style="color:#998;font-style:italic"># 取消换行符</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> -e  <span style="color:#998;font-style:italic"># 启用反斜杠转译</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="4双引号与单引号有什么区别">4、双引号&quot;&ldquo;与单引号&rsquo;&lsquo;有什么区别?</h2>
<ul>
<li>hard quote：&rsquo;&rsquo;（单引号），关闭所有引用</li>
<li>soft quote：&quot;&quot;（双引号），保留$引用</li>
</ul>
<h2 id="5varvalue-export-前后差在哪">5、var=value? export 前后差在哪？</h2>
<ul>
<li>变量定义：name=value，等号左右两边不能使用分隔符。</li>
<li>变量替换：echo ${name}</li>
<li>export变量：export name=value，使变量成为环境变量</li>
</ul>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 本地变量</span>
</span></span><span style="display:flex;"><span><span style="color:#008080">A</span><span style="color:#000;font-weight:bold">=</span>B
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 取消变量</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">unset</span> A
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 环境变量export A=B</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="6exec-跟-source-差在哪">6、exec 跟 source 差在哪？</h2>
<p>环境变量只能从父进程到子进程单向传递。换句话说：在子进程中环境如何变更，均不会影响父进程的环境。</p>
<p>当我们执行一个shell script时，其实是先产生一个sub-shell的子进程， 然后sub-shell再去产生命令行的子进程。</p>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 创建子shell执行脚本</span>
</span></span><span style="display:flex;"><span>./1.sh
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 当前shell执行</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">source</span> 1.sh
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 当前shell执行后退出</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">exec</span> 1.sh
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="7--与---差在哪">7、( ) 与 { } 差在哪？</h2>
<ul>
<li>( )将 command group 置于 sub-shell 执行</li>
<li>{ }则是在同一个shell内完成</li>
</ul>
<h2 id="8-与--还有--差在哪">8、$(()) 与 $() 还有 ${} 差在哪？</h2>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">51
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">52
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">53
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">54
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">55
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">56
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">57
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">58
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">59
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">60
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">61
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">62
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 假设我们定义了一个变量为：</span>
</span></span><span style="display:flex;"><span><span style="color:#008080">file</span><span style="color:#000;font-weight:bold">=</span>/dir1/dir2/dir3/my.file.txt
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 我们可以用 ${ } 分别替换获得不同的值：</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 1. shell字符串的非贪婪(最小匹配)左删除</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>#*/<span style="color:#d14">}</span> <span style="color:#998;font-style:italic"># 拿掉第一条 / 及其左边的字符串：dir1/dir2/dir3/my.file.txt</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 2. shell字符串的贪婪(最大匹配)左删除</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>##*/<span style="color:#d14">}</span> <span style="color:#998;font-style:italic"># 拿掉最后一条 / 及其左边的字符串：my.file.txt</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>##*.<span style="color:#d14">}</span> <span style="color:#998;font-style:italic"># 拿掉最后一个 . 及其左边的字符串：txt</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 3. shell字符串的非贪婪(最小匹配)右删除：</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>%/*<span style="color:#d14">}</span> <span style="color:#998;font-style:italic"># 拿掉最后条 / 及其右边的字符串：/dir1/dir2/dir3</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>%.*<span style="color:#d14">}</span> <span style="color:#998;font-style:italic"># 拿掉最后一个 . 及其右边的字符串：/dir1/dir2/dir3/my.file</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 4. shell字符串的贪婪(最大匹配)右删除：</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>%%/*<span style="color:#d14">}</span> <span style="color:#998;font-style:italic"># 拿掉第一条 / 及其右边的字符串：(空值)</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>%%.*<span style="color:#d14">}</span> <span style="color:#998;font-style:italic"># 拿掉第一个 . 及其右边的字符串：/dir1/dir2/dir3/my</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>记忆的方法为：
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 是去掉左边(在键盘上 # 在 $ 之左边)</span>
</span></span><span style="display:flex;"><span>% 是去掉右边<span style="color:#000;font-weight:bold">(</span>在键盘上 % 在 $ 之右边<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span>单一符号是最小匹配﹔两个符号是最大匹配。
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 5. shell字符串取子串：</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>:<span style="color:#008080">0</span>:<span style="color:#008080">5</span><span style="color:#d14">}</span>：提取最左边的 <span style="color:#099">5</span> 个字节：/dir1
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>:<span style="color:#008080">5</span>:<span style="color:#008080">5</span><span style="color:#d14">}</span>：提取第 <span style="color:#099">5</span> 个字节右边的连续 <span style="color:#099">5</span> 个字节：/dir2
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 6. shell字符串变量值的替换：</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>/dir/path<span style="color:#d14">}</span>：将第一个 dir 提换为 path：/path1/dir2/dir3/my.file.txt
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>//dir/path<span style="color:#d14">}</span>：将全部 dir 提换为 path：/path1/path2/path3/my.file.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 7. ${}还可针对变量的不同状态(没设定、空值、非空值)进行赋值：</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>-my.file.txt<span style="color:#d14">}</span> ：假如 <span style="color:#008080">$file</span> 没有设定，则使用 my.file.txt 作传回值。<span style="color:#000;font-weight:bold">(</span>空值及非空值时不作处理<span style="color:#000;font-weight:bold">)</span> 
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span><span style="color:#000;font-weight:bold">:-</span><span style="color:#008080">my</span>.file.txt<span style="color:#d14">}</span> ：假如 <span style="color:#008080">$file</span> 没有设定或为空值，则使用 my.file.txt 作传回值。<span style="color:#000;font-weight:bold">(</span>非空值时不作处理<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>+my.file.txt<span style="color:#d14">}</span> ：假如 <span style="color:#008080">$file</span> 设为空值或非空值，均使用 my.file.txt 作传回值。<span style="color:#000;font-weight:bold">(</span>没设定时不作处理<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>:+my.file.txt<span style="color:#d14">}</span> ：若 <span style="color:#008080">$file</span> 为非空值，则使用 my.file.txt 作传回值。<span style="color:#000;font-weight:bold">(</span>没设定及空值时不作处理<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>=my.file.txt<span style="color:#d14">}</span> ：若 <span style="color:#008080">$file</span> 没设定，则使用 my.file.txt 作传回值，同时将 <span style="color:#008080">$file</span> 赋值为 my.file.txt 。<span style="color:#000;font-weight:bold">(</span>空值及非空值时不作处理<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>:=my.file.txt<span style="color:#d14">}</span> ：若 <span style="color:#008080">$file</span> 没设定或为空值，则使用 my.file.txt 作传回值，同时将 <span style="color:#008080">$file</span> 赋值为 my.file.txt 。<span style="color:#000;font-weight:bold">(</span>非空值时不作处理<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>?my.file.txt<span style="color:#d14">}</span> ：若 <span style="color:#008080">$file</span> 没设定，则将 my.file.txt 输出至 STDERR。<span style="color:#000;font-weight:bold">(</span>空值及非空值时不作处理<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">file</span>:?my.file.txt<span style="color:#d14">}</span> ：若 <span style="color:#008080">$file</span> 没设定或为空值，则将 my.file.txt 输出至 STDERR。<span style="color:#000;font-weight:bold">(</span>非空值时不作处理<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>tips:
</span></span><span style="display:flex;"><span>以上的理解在于, 你一定要分清楚 <span style="color:#0086b3">unset</span> 与 null 及 non-null 这三种赋值状态.
</span></span><span style="display:flex;"><span>一般而言, : 与 null 有关, 若不带 : 的话, null 不受影响, 若带 : 则连 null 也受影响.
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 8. 计算shell字符串变量的长度：${#var}</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${#</span><span style="color:#008080">var</span><span style="color:#d14">}</span> 可计算出变量值的长度：
</span></span><span style="display:flex;"><span><span style="color:#d14">${#</span><span style="color:#008080">file</span><span style="color:#d14">}</span> 可得到 <span style="color:#099">27</span> ，因为 /dir1/dir2/dir3/my.file.txt 刚好是 <span style="color:#099">27</span> 个字节...
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 9. bash数组(array)的处理方法</span>
</span></span><span style="display:flex;"><span>数组:
</span></span><span style="display:flex;"><span><span style="color:#008080">A</span><span style="color:#000;font-weight:bold">=(</span>a b c d<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span>引用数组:
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">A</span>[@]<span style="color:#d14">}</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">A</span>[*]<span style="color:#d14">}</span>
</span></span><span style="display:flex;"><span>访问数组成员
</span></span><span style="display:flex;"><span><span style="color:#d14">${</span><span style="color:#008080">A</span>[0]<span style="color:#d14">}</span>
</span></span><span style="display:flex;"><span>计算数组长度
</span></span><span style="display:flex;"><span><span style="color:#d14">${#</span><span style="color:#008080">A</span>[@]<span style="color:#d14">}</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">${#</span><span style="color:#008080">A</span>[*]<span style="color:#d14">}</span>
</span></span><span style="display:flex;"><span>数组重新赋值
</span></span><span style="display:flex;"><span>A<span style="color:#000;font-weight:bold">[</span>2<span style="color:#000;font-weight:bold">]=</span>xyz
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 10.$(( ))是用来做整数运算的 </span>
</span></span><span style="display:flex;"><span><span style="color:#008080">a</span><span style="color:#000;font-weight:bold">=</span>5;<span style="color:#008080">b</span><span style="color:#000;font-weight:bold">=</span>7;<span style="color:#008080">c</span><span style="color:#000;font-weight:bold">=</span>2;
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> <span style="color:#000;font-weight:bold">$((</span> a <span style="color:#000;font-weight:bold">+</span> b <span style="color:#000;font-weight:bold">*</span> c<span style="color:#000;font-weight:bold">))</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="9-与--区别在哪">9、$@ 与 $* 区别在哪？</h2>
<ul>
<li>&ldquo;$@&ldquo;则可得到 “p1” “p2 p3” “p4” 这三个不同的词段</li>
<li>&ldquo;$*&ldquo;则可得到 “p1 p2 p3 p4” 这一整串单一的词段</li>
</ul>
<h2 id="10-与--差在哪">10、&amp;&amp; 与 || 差在哪？</h2>
<h3 id="101test命令有两种形式">10.1、test命令有两种形式</h3>
<ul>
<li>test expression</li>
<li>[ expression ]</li>
</ul>
<h3 id="102bash的test目前支持三种测试对象">10.2、bash的test目前支持三种测试对象</h3>
<ul>
<li>string：字符串</li>
<li>integer：整数</li>
<li>file：文件</li>
</ul>
<h3 id="103当-expression-为真是返回-0true-否则返回-非0false">10.3、当 expression 为真是返回 0（true） ，否则返回 非0（false）</h3>
<ul>
<li>command1 &amp;&amp; command2  command2 只有在 command1 的RV为0（True）的条件下执行。</li>
<li>command1 || command2  command2只有在command1的RV为非0(False)的条件下执行。</li>
</ul>
<h3 id="104先替换变量再比较">10.4、先替换变量再比较</h3>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#008080">A</span><span style="color:#000;font-weight:bold">=</span>123<span style="color:#000;font-weight:bold">[</span> -n <span style="color:#d14">&#34;</span><span style="color:#008080">$A</span><span style="color:#d14">&#34;</span> <span style="color:#000;font-weight:bold">]</span> <span style="color:#000;font-weight:bold">&amp;&amp;</span> <span style="color:#000;font-weight:bold">([</span> <span style="color:#d14">&#34;</span><span style="color:#008080">$A</span><span style="color:#d14">&#34;</span> -lt <span style="color:#099">100</span> <span style="color:#000;font-weight:bold">]</span> <span style="color:#000;font-weight:bold">||</span> <span style="color:#0086b3">echo</span> <span style="color:#d14">&#34;too big&#34;</span><span style="color:#000;font-weight:bold">)</span><span style="color:#0086b3">unset</span> A
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="11-与--差在哪">11、&gt; 与 &lt; 差在哪？</h2>
<ul>
<li>0: Standard Input（STDIN）</li>
<li>1: Standard Output （STDOUT）</li>
<li>2: Standard Error Output（STDERR）</li>
</ul>
<p>我们可用 &lt; 来改变读进的数据信道（stdin），使之从指定的档案读进。</p>
<p>我们可用 &gt; 来改变送出的数据信道（stdout, stderr），使之输出到指定的档案。</p>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>ls my.file no.such.file 1&gt; file.out 2&gt;file.err
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 2&gt;&amp;1 就是将stderr并进stdout做输出</span>
</span></span><span style="display:flex;"><span>ls my.file no.such.file 1&gt; file.out 2&gt;&amp;<span style="color:#099">1</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># /dev/null 空</span>
</span></span><span style="display:flex;"><span>ls my.file no.such.file &gt;/dev/null 2&gt;&amp;<span style="color:#099">1</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>cat &lt; file &gt; file
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 在 IO Redirection 中，stdout 与 stderr 的管道会先准备好，才会从 stdin 读进资料。</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 也就是说，在上例中，&gt; file 会先将 file 清空，然后才读进 &lt; file ， </span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 但这时候档案已经被清空了，因此就变成读不进任何数据了</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="12你要if还是case呢">12、你要if还是case呢？</h2>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># if</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> -n <span style="color:#d14">&#34;Do you want to continue?(Yes/No):&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">read</span> YN
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> <span style="color:#000;font-weight:bold">[</span> <span style="color:#d14">&#34;</span><span style="color:#008080">$YN</span><span style="color:#d14">&#34;</span><span style="color:#000;font-weight:bold">=</span>Y -o <span style="color:#d14">&#34;</span><span style="color:#008080">$YN</span><span style="color:#d14">&#34;</span><span style="color:#000;font-weight:bold">=</span>y -o <span style="color:#d14">&#34;</span><span style="color:#008080">$YN</span><span style="color:#d14">&#34;</span><span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#34;Yes&#34;</span> -o <span style="color:#d14">&#34;</span><span style="color:#008080">$YN</span><span style="color:#d14">&#34;</span><span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#34;yes&#34;</span> -o <span style="color:#d14">&#34;</span><span style="color:#008080">$YN</span><span style="color:#d14">&#34;</span><span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#34;YES&#34;</span><span style="color:#000;font-weight:bold">]</span>;<span style="color:#000;font-weight:bold">then</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> <span style="color:#d14">&#34;continue&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">else</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">exit</span> <span style="color:#099">0</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">fi</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># case</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> -n <span style="color:#d14">&#34;Do you want to continue?(Yes/No):&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">read</span> YN
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">case</span> <span style="color:#d14">&#34;</span><span style="color:#008080">$YN</span><span style="color:#d14">&#34;</span> in
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">[</span>Yy<span style="color:#000;font-weight:bold">]</span>|<span style="color:#000;font-weight:bold">[</span>Yy<span style="color:#000;font-weight:bold">][</span>Ee<span style="color:#000;font-weight:bold">][</span>Ss<span style="color:#000;font-weight:bold">])</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> <span style="color:#d14">&#34;continue&#34;</span>
</span></span><span style="display:flex;"><span>;;
</span></span><span style="display:flex;"><span>*<span style="color:#000;font-weight:bold">)</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">exit</span> <span style="color:#099">0</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">esac</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="13for-what-while与until差在哪">13、for what? while与until差在哪？</h2>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># for</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">for</span> <span style="color:#000;font-weight:bold">((</span><span style="color:#008080">i</span><span style="color:#000;font-weight:bold">=</span>1;i&lt;<span style="color:#000;font-weight:bold">=</span>10;i++<span style="color:#000;font-weight:bold">))</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">do</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> <span style="color:#d14">&#34;num is </span><span style="color:#008080">$i</span><span style="color:#d14">&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">done</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># while</span>
</span></span><span style="display:flex;"><span><span style="color:#008080">num</span><span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">while</span> <span style="color:#000;font-weight:bold">[</span> <span style="color:#d14">&#34;</span><span style="color:#008080">$num</span><span style="color:#d14">&#34;</span> -le <span style="color:#099">10</span> <span style="color:#000;font-weight:bold">]</span>; <span style="color:#000;font-weight:bold">do</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> <span style="color:#d14">&#34;num is </span><span style="color:#008080">$num</span><span style="color:#d14">&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#008080">num</span><span style="color:#000;font-weight:bold">=</span><span style="color:#000;font-weight:bold">$((</span><span style="color:#008080">$num</span> <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">1</span><span style="color:#000;font-weight:bold">))</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">done</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># until</span>
</span></span><span style="display:flex;"><span><span style="color:#008080">num</span><span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">until</span> <span style="color:#000;font-weight:bold">[</span> <span style="color:#d14">&#34;</span><span style="color:#008080">$num</span><span style="color:#d14">&#34;</span> -gt <span style="color:#099">10</span> <span style="color:#000;font-weight:bold">]</span>; <span style="color:#000;font-weight:bold">do</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">echo</span> <span style="color:#d14">&#34;num is </span><span style="color:#008080">$num</span><span style="color:#d14">&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#008080">num</span><span style="color:#000;font-weight:bold">=</span><span style="color:#000;font-weight:bold">$((</span><span style="color:#008080">$nu</span> <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">1</span><span style="color:#000;font-weight:bold">))</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">done</span>
</span></span></code></pre></td></tr></table>
</div>
</div><ul>
<li>break 是结束 loop</li>
<li>return 是结束 function</li>
<li>exit 是结束 script/shell</li>
</ul>

        </div>

        
<div class="post-archive">
    <ul class="post-copyright">
        <li><strong>原文作者：</strong><a rel="author" href="https://anttu.gitee.io/">Anttu</a></li>
        <li style="word-break:break-all"><strong>原文链接：</strong><a href="https://anttu.gitee.io/post/2022-04-22-shell_question/">https://anttu.gitee.io/post/2022-04-22-shell_question/</a></li>
        <li><strong>版权声明：</strong>本作品采用<a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/">知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议</a>进行许可，非商业转载请注明出处（作者，原文链接），商业转载请联系作者获得授权。</li>
    </ul>
</div>
<br/>



        

<div class="post-archive">
    <h2>See Also</h2>
    <ul class="listing">
        
        <li><a href="/post/2022-04-02-spring_cloud_gateway/">spring cloud gateway的一些细节注意</a></li>
        
        <li><a href="/post/2022-03-23-linux_backend_execute/">linux后台执行可用方式整理</a></li>
        
        <li><a href="/post/2022-03-05-redis_safe/">redis日常使用的一些建议</a></li>
        
        <li><a href="/post/2022-02-13-logrotate/">logrotate日志切割</a></li>
        
        <li><a href="/post/2022-02-07-spring_cli/">springboot cli&amp;springcloud cli简单介绍</a></li>
        
    </ul>
</div>


        <div class="post-meta meta-tags">
            
            没有标签
            
        </div>
    </article>
    
    

    
    
    <div class="post bg-white">
      <script src="https://utteranc.es/client.js"
            repo= "anTtutu/anTtutu.github.io"
            issue-term="pathname"
            theme="github-light"
            crossorigin="anonymous"
            async>
      </script>
    </div>
    
    
    
</div>

                    <footer id="footer">
    <div>
        &copy; 2025 <a href="https://anttu.gitee.io/">Anttu&#39;s Blog By Anttu</a>
        
    </div>
    <br />
    <div>
        <div class="github-badge">
            <a href="https://gohugo.io/" target="_black" rel="nofollow"><span class="badge-subject">Powered by</span><span class="badge-value bg-blue">Hugo</span></a>
        </div>
        
        <div class="github-badge">
            <a href="https://github.com/flysnow-org/maupassant-hugo" target="_black"><span class="badge-subject">Theme</span><span class="badge-value bg-yellowgreen">Maupassant</span></a>
        </div>
    </div>
</footer>


    
    
    <script type="text/javascript">
        window.MathJax = {
            tex2jax: {
                inlineMath: [['$', '$']],
                processEscapes: true
                }
            };
    </script>
    <script src='//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML' async></script>

<a id="rocket" href="#top"></a>
<script type="text/javascript" src='/js/totop.js?v=0.0.0' async=""></script>
<style type="text/css">
div.highlight {
    position: relative;
    margin: 1em 0px;
}

.copy-code {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(78, 78, 78, 0.8);
    border-radius: var(--radius);
    padding: 0 5px;
    font: inherit;
    user-select: none;
    cursor: pointer;
    border: 0;
    --radius: 8px;
}

div.highlight:hover .copy-code,pre:hover .copy-code {
    display: block;
}

</style>
<script>
    document.querySelectorAll('pre > code').forEach((codeblock) => {
        const container = codeblock.parentNode.parentNode;

        const copybutton = document.createElement('button');
        copybutton.classList.add('copy-code');
        copybutton.innerHTML = 'copy';

        function copyingDone() {
            copybutton.innerHTML = 'copied!';
            setTimeout(() => {
                copybutton.innerHTML = 'copy';
            }, 2000);
        }

        copybutton.addEventListener('click', (cb) => {
            if ('clipboard' in navigator) {
                navigator.clipboard.writeText(codeblock.textContent);
                copyingDone();
                return;
            }

            const range = document.createRange();
            range.selectNodeContents(codeblock);
            const selection = window.getSelection();
            selection.removeAllRanges();
            selection.addRange(range);
            try {
                document.execCommand('copy');
                copyingDone();
            } catch (e) { };
            selection.removeRange(range);
        });

        if (container.classList.contains("highlight")) {
            container.appendChild(copybutton);
        } else if (container.parentNode.firstChild == container) {
            
        } else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") {
            
            codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton);
        } else {
            
            codeblock.parentNode.appendChild(copybutton);
        }
    });
</script>


    <script type="text/javascript" src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" async></script>




    <script src='/js/asciinema-player.js'></script>

                </div>

                <div id="secondary">
    <section class="widget">
        <form id="search" action='https://anttu.gitee.io/search' method="get" accept-charset="utf-8" target="_blank" _lpchecked="1">
      
      <input type="text" name="q" maxlength="20" placeholder="Search">
      <input type="hidden" name="sitesearch" value="https://anttu.gitee.io/">
      <button type="submit" class="submit icon-search"></button>
</form>
    </section>
    
    <section class="widget">
        <h3 class="widget-title">最近文章</h3>
<ul class="widget-list">
    
    <li>
        <a href="https://anttu.gitee.io/post/2025-02-13-mvnd/" title="mvnd结合idea使用" target="_blank">mvnd结合idea使用</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2024-04-15-postgresql/" title="postgresql数据库常用记录" target="_blank">postgresql数据库常用记录</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2023-06-16-miner_virus_5/" title="挖矿病毒5-私有云机房挖矿病毒定位" target="_blank">挖矿病毒5-私有云机房挖矿病毒定位</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-12-26-covid-19/" title="羊了" target="_blank">羊了</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-12-19-git_delete_history/" title="git删除历史提交记录" target="_blank">git删除历史提交记录</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-11-28-python_muilt_version/" title="python多版本管理工具" target="_blank">python多版本管理工具</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-11-22-springboot_start_failed/" title="springboot常见兼容性错误" target="_blank">springboot常见兼容性错误</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-11-14-docker_port/" title="docker修改运行的容器端口" target="_blank">docker修改运行的容器端口</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-11-10-go_muilt_version/" title="go多版本管理工具" target="_blank">go多版本管理工具</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-10-27-jenkins_reset/" title="jenkins的admin密码忘记了如何重置" target="_blank">jenkins的admin密码忘记了如何重置</a>
    </li>
    
</ul>
    </section>

    

    <section class="widget">
        <h3 class="widget-title"><a href='/categories/'>分类</a></h3>
<ul class="widget-list">
    
    <li><a href="https://anttu.gitee.io/categories/about/">about (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/android/">android (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/app/">app (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/aria2/">aria2 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/arm64/">arm64 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/arthas/">arthas (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/awr/">awr (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/backend_execute/">backend_execute (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/backup/">backup (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/blog/">blog (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/bug/">bug (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/build/">build (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cache/">cache (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/caffeine/">caffeine (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/captcha/">captcha (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/check/">check (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/clean/">clean (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cli/">cli (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cluster/">cluster (4)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/covid-19/">covid-19 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cve/">cve (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cygwin/">cygwin (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/dataguard/">dataguard (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/db/">db (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/deepfacelab/">deepfacelab (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/devops/">devops (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/docker/">docker (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/dockerfile/">dockerfile (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/dos/">dos (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/dump/">dump (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/eclipse/">eclipse (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/explain/">explain (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/faker/">faker (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/gcc/">gcc (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/git/">git (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/gitment/">gitment (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/gitpages/">gitpages (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/go/">go (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/h2/">h2 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/h5/">h5 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/ha/">ha (4)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/http/">http (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/hugo/">hugo (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/id/">id (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/idea/">idea (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/java/">java (24)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jekyll/">jekyll (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jenkins/">jenkins (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jrebel/">jrebel (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/js/">js (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jsr/">jsr (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jvm/">jvm (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/kafka/">kafka (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/kali/">kali (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/kenlm/">kenlm (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/linux/">linux (22)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/log/">log (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/log4j/">log4j (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/lombok/">lombok (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mac/">mac (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/matplotlib/">matplotlib (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/maven/">maven (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mine/">mine (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mongodb/">mongodb (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mvnd/">mvnd (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mysql/">mysql (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/nginx/">nginx (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/nmap/">nmap (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/oom/">oom (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/oracle/">oracle (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/orangePi/">orangePi (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/package/">package (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/pandas/">pandas (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/pg/">pg (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/port/">port (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/postgresql/">postgresql (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/python/">python (8)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/rec/">rec (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/redis/">redis (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/regexp/">regexp (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/safe/">safe (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/sdk/">sdk (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/shell/">shell (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/split/">split (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/springboot/">springboot (4)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/springcloud/">springcloud (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/sqlmap/">sqlmap (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/ssd/">ssd (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/tcp/">tcp (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/termux/">termux (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/test/">test (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/testing/">testing (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/union_id/">union_id (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/vcs/">vcs (7)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/virus/">virus (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/vxvm/">vxvm (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/win10/">win10 (6)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/xrebel/">xrebel (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/ynote/">ynote (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/zk/">zk (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/zookeeper/">zookeeper (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/%E5%89%8D%E7%AB%AF/">前端 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/%E5%AE%B9%E7%81%BE/">容灾 (1)</a></li>
    
</ul>
    </section>

    <section class="widget">
        <h3 class="widget-title"><a href='/tags/'>标签</a></h3>
<div class="tagcloud">
    
    <a href="https://anttu.gitee.io/tags/about/">about</a>
    
    <a href="https://anttu.gitee.io/tags/android/">android</a>
    
    <a href="https://anttu.gitee.io/tags/app/">app</a>
    
    <a href="https://anttu.gitee.io/tags/aria2/">aria2</a>
    
    <a href="https://anttu.gitee.io/tags/arm64/">arm64</a>
    
    <a href="https://anttu.gitee.io/tags/awr/">awr</a>
    
    <a href="https://anttu.gitee.io/tags/backup/">backup</a>
    
    <a href="https://anttu.gitee.io/tags/blog/">blog</a>
    
    <a href="https://anttu.gitee.io/tags/bug/">bug</a>
    
    <a href="https://anttu.gitee.io/tags/build/">build</a>
    
    <a href="https://anttu.gitee.io/tags/captcha/">captcha</a>
    
    <a href="https://anttu.gitee.io/tags/check/">check</a>
    
    <a href="https://anttu.gitee.io/tags/cluster/">cluster</a>
    
    <a href="https://anttu.gitee.io/tags/cygwin/">cygwin</a>
    
    <a href="https://anttu.gitee.io/tags/dataguard/">dataguard</a>
    
    <a href="https://anttu.gitee.io/tags/deepfacelab/">deepfacelab</a>
    
    <a href="https://anttu.gitee.io/tags/dos/">dos</a>
    
    <a href="https://anttu.gitee.io/tags/eclipse/">eclipse</a>
    
    <a href="https://anttu.gitee.io/tags/explain/">explain</a>
    
    <a href="https://anttu.gitee.io/tags/gcc/">gcc</a>
    
    <a href="https://anttu.gitee.io/tags/gitment/">gitment</a>
    
    <a href="https://anttu.gitee.io/tags/gitpages/">gitpages</a>
    
    <a href="https://anttu.gitee.io/tags/go/">go</a>
    
    <a href="https://anttu.gitee.io/tags/h2/">h2</a>
    
    <a href="https://anttu.gitee.io/tags/h5/">h5</a>
    
    <a href="https://anttu.gitee.io/tags/ha/">ha</a>
    
    <a href="https://anttu.gitee.io/tags/http/">http</a>
    
    <a href="https://anttu.gitee.io/tags/hugo/">hugo</a>
    
    <a href="https://anttu.gitee.io/tags/java/">java</a>
    
    <a href="https://anttu.gitee.io/tags/jekyll/">jekyll</a>
    
    <a href="https://anttu.gitee.io/tags/jrebel/">jrebel</a>
    
    <a href="https://anttu.gitee.io/tags/js/">js</a>
    
    <a href="https://anttu.gitee.io/tags/jsr/">jsr</a>
    
    <a href="https://anttu.gitee.io/tags/kafka/">kafka</a>
    
    <a href="https://anttu.gitee.io/tags/kali/">kali</a>
    
    <a href="https://anttu.gitee.io/tags/kenlm/">kenlm</a>
    
    <a href="https://anttu.gitee.io/tags/linux/">linux</a>
    
    <a href="https://anttu.gitee.io/tags/log4j/">log4j</a>
    
    <a href="https://anttu.gitee.io/tags/mac/">mac</a>
    
    <a href="https://anttu.gitee.io/tags/mine/">mine</a>
    
    <a href="https://anttu.gitee.io/tags/mongodb/">mongodb</a>
    
    <a href="https://anttu.gitee.io/tags/mysql/">mysql</a>
    
    <a href="https://anttu.gitee.io/tags/nginx/">nginx</a>
    
    <a href="https://anttu.gitee.io/tags/oom/">oom</a>
    
    <a href="https://anttu.gitee.io/tags/oracle/">oracle</a>
    
    <a href="https://anttu.gitee.io/tags/orangePi/">orangePi</a>
    
    <a href="https://anttu.gitee.io/tags/python/">python</a>
    
    <a href="https://anttu.gitee.io/tags/rec/">rec</a>
    
    <a href="https://anttu.gitee.io/tags/redis/">redis</a>
    
    <a href="https://anttu.gitee.io/tags/safe/">safe</a>
    
    <a href="https://anttu.gitee.io/tags/shell/">shell</a>
    
    <a href="https://anttu.gitee.io/tags/springboot/">springboot</a>
    
    <a href="https://anttu.gitee.io/tags/sqlmap/">sqlmap</a>
    
    <a href="https://anttu.gitee.io/tags/ssd/">ssd</a>
    
    <a href="https://anttu.gitee.io/tags/tcp/">tcp</a>
    
    <a href="https://anttu.gitee.io/tags/termux/">termux</a>
    
    <a href="https://anttu.gitee.io/tags/union_id/">union_id</a>
    
    <a href="https://anttu.gitee.io/tags/vcs/">vcs</a>
    
    <a href="https://anttu.gitee.io/tags/virus/">virus</a>
    
    <a href="https://anttu.gitee.io/tags/vxvm/">vxvm</a>
    
    <a href="https://anttu.gitee.io/tags/win10/">win10</a>
    
    <a href="https://anttu.gitee.io/tags/xrebel/">xrebel</a>
    
    <a href="https://anttu.gitee.io/tags/ynote/">ynote</a>
    
    <a href="https://anttu.gitee.io/tags/zk/">zk</a>
    
    <a href="https://anttu.gitee.io/tags/zookeeper/">zookeeper</a>
    
    <a href="https://anttu.gitee.io/tags/%E5%AE%B9%E7%81%BE/">容灾</a>
    
</div>
    </section>

    

    <section class="widget">
        <h3 class="widget-title">其它</h3>
        <ul class="widget-list">
            <li><a href="https://anttu.gitee.io/index.xml">文章 RSS</a></li>
        </ul>
    </section>
</div>
            </div>
        </div>
    </div>
</body>

</html>